#ifdef __EOS__
#include <rtthread.h>
#else
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/printk.h>
#include <linux/version.h>
#include <linux/of_platform.h>
#endif

#include "ei_type.h"
#include "ei_common.h"
#include "ei_os.h"

extern int MBASE_ModInit(void);
extern void MBASE_ModExit(void);

#ifdef __EOS__

int mbase_driver_init(void)
{
    os_printk("mbase_driver_init\n");

#if defined (ARCH_LOMBO_N7V3)
    os_printk("mbase find N7V3 platform!\n");
#elif defined (ARCH_LOMBO_N7V7)
    os_printk("mbase find N7V7 platform!\n");
#else
    os_printk("mbase find no match platform!\n");
#endif

    MBASE_ModInit();

    return 0;
}

#else

static int ei_mbase_probe(struct platform_device *pdev)
{
    os_printk("%s\n", "mbase init ok");

#if defined (ARCH_LOMBO_N7V3)
    os_printk("mbase find N7V3 platform!\n");
#elif defined (ARCH_LOMBO_N7V7)
    os_printk("mbase find N7V7 platform!\n");
#else
    os_printk("mbase find no match platform!\n");
#endif

    MBASE_ModInit();

    return 0;
}

static int ei_mbase_remove(struct platform_device *pdev)
{
    os_printk("%s\n", "mbase exit ok");

    MBASE_ModExit();

    return 0;
}

static const struct of_device_id ei_mbase_match[] = {
    { .compatible = "ei, ei-mbase" },
    {},
};

MODULE_DEVICE_TABLE(of, ei_mbase_match);

static struct platform_driver ei_mbase_driver = {
    .probe          = ei_mbase_probe,
    .remove         = ei_mbase_remove,
    .driver         =
    {
        .name           = "ei_mbase",
        .of_match_table = ei_mbase_match,
    },
};

os_module_platform_driver(ei_mbase_driver);

MODULE_LICENSE("Proprietary");

#endif /* __EOS__ */

